package geektime.spring.springbucks.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created by PC on 2022/6/16.
 */

@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {

//    @Override
//    public void addViewControllers(ViewControllerRegistry registry) {
//        //super.addViewControllers(registry);
//        registry.addViewController("/").setViewName("index");
//        registry.addViewController("/index.html").setViewName("index");
//    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //静态资源路径 css,js,img等
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
        //视图
//        registry.addResourceHandler("/templates/**").addResourceLocations("classpath:/templates/");
        //mapper.xml
//        registry.addResourceHandler("/mapper/**").addResourceLocations("classpath:/mapper/");
//        super.addResourceHandlers(registry);
    }
}
